import { Register_fail, Register_loading, Register_success } from "../Type"

// 验证码+手机号注册
let register_verification_code = {
    state: 'default',
    register: false,
    loading: false,
    data: []
}

const register_verification_code_reducer = (status = register_verification_code, action) => {
    if (action.type === Register_loading) {
        return {
            state: action.msg,
            register: false,
            loading:true,
        }
    }
    if (action.type === Register_success) {
        return {
            state:action.msg,
            register:true,
            loading:true,
            data:action.data
        }
    }
    if (action.type === Register_fail) {
        return{
            state:action.msg,
            register:false,
            loading:false,
        }
    }
    return status
}

export default register_verification_code_reducer